<?php
namespace app\admin\controller;

class Login extends Admin{
    public function index(){
    	return $this->fetch();
    }
    public function login(){
    	$data = input("param.");
    	$result = $this->validate($data,"AdminUser.login");
    	if($result !== true){
    		return json(['status'=>0,'data'=>[],'msg'=>$result]);
    	}
    	list($status,$msg) = model("AdminUser")->login($data['username'],$data['password']);
    	return json(['status'=>$status,'data'=>[],'msg'=>$msg]);
    }
    public function logout(){
    	session("uinfo",null);
		session("islogin",null);
		session("username",null);
		session("realname",null);
		$this->redirect(url('login/index'));
    }
}